layui.config({base: top.basePath+'/static/common/layui/js/'})
    .define(['layer'], function(exports) {
    "use strict";

    var $=layui.jquery;

    /**
     * @constructor newTable 构造函数
     */
    var NewLayer = function() {
    	this.target=layui.layer;
        this.config = {
            title: undefined,
            maxmin: true,
            type: 2,
            content: undefined,
            area: ['90%', '90%'],
            offset: '20px',
            btn:undefined,
            yes:undefined
        };
    };

    /**
     * @description 查询条件
     * @param {Object} options
     */
    NewLayer.prototype.open = function(option) {
        var that = this;
        $.extend(true, that.config, option);

        return that.target.open(that.config);
    };

    NewLayer.prototype.download = function(option) {
        var that = this;
        $.extend(true, that.config, option);

        var index=that.target.open(that.config);

        setTimeout(that.target.close(index),5000)
    };


    NewLayer.prototype.msg = function(msg,option) {
        var that = this;
        return that.target.msg(msg,option);
    };
    NewLayer.prototype.confirm = function(msg,yes) {
        var that = this;
        return that.target.confirm(msg,{btn:['确定','取消']},yes);
    };
    NewLayer.prototype.alert = function(msg,option) {
        var that = this;
        return that.target.alert(msg,option);
    };
    NewLayer.prototype.close = function(index) {
        var that = this;
        return that.target.close(index);
    };
    //var loadIndex=layui.newLayer.load(2), 开启加载框
    NewLayer.prototype.load = function(index) {
        var that = this;
        return that.target.load(index);
    };


    var newLayer=new NewLayer();

    exports('newLayer', newLayer);
});